<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
 String path = request.getContextPath();
 String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html lang="zh-CN">
	<head>
	<base href="<%=basePath%>">
	<title>更改资料- SegmentFault</title>
	<jsp:include page="../common/_meta.jsp"></jsp:include>
	</head>
<body>
	<jsp:include page="../common/_header.jsp"></jsp:include>
	<div class="wrap">
		<div class="inner edge">
			<c:if test="${tab == null ||  tab eq 'post'}">
				<h2 class="common-title">我的个人资料</h2>
				<div id="main" class="settings">
					<form action="user/settings?tab=post" method="post" class="session-form" >
						<div class="session-aside">
							<img class="avatar-128" src="${user.head_photo")}" alt="头像">
							<div class="change-avatar">
								<a href="#" class="btn-regular">修改头像</a>
							</div>
							从电脑中选择图片上传, 图像大小不要超过 2 MB
						</div>
						<p style="position: relative;">
							<label for="setting-name">* 称呼</label> 
							<input name="user.login_name" id="setting-name" type="text" maxlength="32" placeholder="常用昵称或真名" class="text-32" value='${user.login_name")}' required="">
						</p>
						<p class="fix-size">
							<label>性别</label>
							<input name="user.sex" type="radio" id="sex-none" value="0" <c:if test="${user.sex ==0 }">checked="checked"</c:if>>
							<label for="sex-none">保密</label> &nbsp;&nbsp;
							<input name="user.sex" type="radio" id="sex-male" value="1" <c:if test="${user.sex ==1 }">checked="checked"</c:if>>
							<label for="sex-male">男</label> &nbsp;&nbsp; 
							<input name="user.sex" type="radio" id="sex-female" value="2" <c:if test="${user.sex ==2 }">checked="checked"</c:if>>
							<label for="sex-female">女</label>
						</p>
						<p style="position: relative;">
							<label for="setting-birthday">生日</label> 
							<input name="user.birthday" id="setting-birthday" type="text" placeholder="格式 YYYY-mm-dd" value="${user.birthday }" class="text-32 placeholder">
						</p>
						<p style="position: relative;">
							<label for="setting-address">家庭住址</label> <input name="user.home_add" id="setting-address" type="text"  maxlength="16" placeholder="例如: 湖北武汉" value="${user.home_add }" class="text-32 placeholder">
						</p>
						<p style="position: relative;">
							<label for="setting-address">现居地</label> <input name="user.living_add" id="setting-address" type="text" maxlength="16" placeholder="例如: 湖北武汉"  value="${user.living_add}" class="text-32 placeholder">
						</p>
						<p style="position: relative;">
							<label for="setting-homepage">QQ</label> <input name="user.qq" id="setting-homepage" type="number" value="${user.qq}" class="text-32 placeholder">
						</p>
						<p>
							<label for="setting-description">个性签名</label>
							<textarea name="user.signature" id="setting-description"
								class="textarea-14" rows="4">${user.signature}</textarea>
						</p>
						<div class="form-action">
							<input type="submit" class="btn btn-big" value="提交">
						</div>
					</form>
				</div>
				<!-- end #main -->
			</c:if>
			<c:if test="${tab eq 'auth' }">
				<h2 class="common-title">修改密码</h2>
				<div id="main" class="settings">
					<form action="user/settingPwd?tab=auth" method="post"
						class="session-form">
						<p>
							<label for="old-password">* 当前密码</label> 
								<input name="oldpassword" id="old-password" type="password" class="text-32" required="">
							<c:if test="${errorPwdOld eq '1'}">
								<span class="text-error">原密码错误！</span>
							</c:if>
						</p>
						<p>
							<label for="password">* 新密码</label> 
								<input name="password" id="password" type="password" class="text-32" required="">
							<c:if test="${errorPwd eq '1'}">
								<span class="text-error">密码6～20位！</span>
							</c:if>
						</p>
						<p>
							<label for="confirm-password">* 重复新密码</label> 
								<input name="confirmpassword" id="confirm-password" type="password" class="text-32" required="">
							<c:if test="${errorPwdConfirm eq '1'}">
								<span class="text-error">两次输入不一致</span>
							</c:if>
						</p>
						<div class="form-action">
							<input type="submit" class="btn btn-big" value="提交">
						</div>
					</form>
				</div>
			</c:if>
			<div id="secondary">
				<aside>
					<ul class="list-menu">
						<li <c:if test="${tab == null ||  tab eq 'post'}">class="current"</c:if>>
							<a href="user/settings">我的个人资料</a>
						</li>
						<li <c:if test="${tab eq 'auth' }">class="current"</c:if>>
							<a href="user/settings?tab=auth">修改密码</a>
						</li>
					</ul>
				</aside>
			</div>
			<!-- end #secondary -->
		</div>
	</div>
	<!-- end .wrap -->

	<jsp:include page="../common/_footer.jsp"></jsp:include>
	<div class="pop-overlay hidden" style="opacity: 0.5; position: absolute; background-color: rgb(0, 0, 0); left: 0px; top: 0px; width: 100%; height: 823px; z-index: 10000;"></div>
	<div class="pop-window pop-auto hidden" style="position: absolute; top: 119px; left: 584px; z-index: 10001;">
		<form action="user/upload" enctype="multipart/form-data" method="post">
			<div class="pop-head"><a class="i-cancel close" href="#">✕</a><h4>图片上传</h4></div>
			<div class="pop-body form">
				<p id="tab-upload" class="file-upload">
					<input type="file" name="uphoto" class="file">
					<input type="text" class="text-28" readonly=""> <a href="#" class="btn-regular">选择图片</a><br><br>图片体积不得大于 4 MB
				</p>
			</div>
			<div class="pop-foot form-action">
				<input type="reset" class="btn btn-medium cancel" value="取消">
				<input type="submit" class="btn btn-medium action" value="上传头像">
			</div>
		</form>
	</div>	
</body>
<script type="text/javascript">
	$(function (){
		$(".btn-regular").click(function(){
			$(".pop-overlay").removeClass("hidden");	
			$(".pop-window").removeClass("hidden");
			return false;
		});
		$(".close").click(function(){
			$(".pop-overlay").addClass("hidden");	
			$(".pop-window").addClass("hidden");
			return false;
		});
		$(".cancel").click(function(){
			$(".pop-overlay").addClass("hidden");	
			$(".pop-window").addClass("hidden");
			return false;
		});
	});
</script>
</html>